/*
 * 
 * 
 * 
 */
package com.cms.controller.admin;

import com.cms.domain.Feedback;
import com.cms.entity.Company;
import com.cms.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;


/**
 * Controller - 公司信息
 * 
 * 
 * 
 */
@Controller("adminCompanyController")
@RequestMapping("/admin/company")
public class CompanyController extends BaseController {

	@Autowired
	private CompanyService companyService;

	/**
	 * 编辑
	 */
	@RequestMapping
	public String index(ModelMap modelMap){
		Company company = companyService.findBySiteId(getCurrentSite().getId());
		modelMap.addAttribute("company", company);
		return getView("company/index");
	}
	
	/**
	 * 修改
	 */
	@ResponseBody
	@RequestMapping("/update")
	public Feedback update(Company company){
		companyService.updateById(company);
		return Feedback.success(new HashMap<>());
	}
	
}
